package vip.xiaonuo.megvii.facegroups.delete;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vip.xiaonuo.facedoor.modular.memberfeatures.entity.MemberFeatures;
import vip.xiaonuo.modular.facegroupfacetokenrela.entity.FacegroupFacetokenRela;
import vip.xiaonuo.modular.facegroupfacetokenrela.param.FacegroupFacetokenRelaParam;
import vip.xiaonuo.modular.facegroupfacetokenrela.service.FacegroupFacetokenRelaService;
import vip.xiaonuo.modular.facegrouporgrelate.entity.FacegroupOrgRelate;
import vip.xiaonuo.modular.facegrouporgrelate.param.FacegroupOrgRelateParam;
import vip.xiaonuo.modular.facegrouporgrelate.service.FacegroupOrgRelateService;
import vip.xiaonuo.modular.megviifacegroup.entity.MegviiFaceGroup;
import vip.xiaonuo.modular.megviifacegroup.service.MegviiFaceGroupService;

import javax.validation.constraints.NotNull;
import java.util.List;


@Service
public interface FaceGroupDeleteStrategy {

    @Transactional(rollbackFor = Exception.class)
    void delete(MegviiFaceGroup faceGroup);

    default List<FacegroupFacetokenRela> getRelas(@NotNull FacegroupFacetokenRelaService service, Long groupId){
        FacegroupFacetokenRelaParam param = new FacegroupFacetokenRelaParam();
        param.setFaceGroupId(groupId);
        return service.list(param);
    }

    default void deleteFaceGroupOrgRelate(@NotNull FacegroupOrgRelateService service, Long groupId){
        FacegroupOrgRelateParam param = new FacegroupOrgRelateParam();
        param.setFaceGroupId(groupId);
        service.removeBatchByIds(service.list(param));
    }

}
